import requests
import json

# payload_overview = {
#     'brand': '艾蓓怡'
# }
#
# r_overview = requests.post('http://localhost:5000/search/v1.1/wechat/brands', json=payload_overview, timeout=200)
# a_overview = r_overview.json()
# print("2\n")
# print(json.dumps(a_overview, indent=4, sort_keys=True, ensure_ascii=False))
#
# payload_overview = {
#         'biz_code' : '',
#         'biz_name' : '',
#         'class1_id' :'',
#         'class1_name' : '',
#         'term': '艾蓓怡 艾蓓怡女装 王潇雨 女装  连衣裙',
#         'from': 0,
#         'size': 10
# }
#
# r_overview = requests.post('http://localhost:5000/search/v1.1/wechat/brands_match', json=payload_overview, timeout=200)
# a_overview = r_overview.json()
# print("2\n")
# print(json.dumps(a_overview, indent=4, sort_keys=True, ensure_ascii=False))

# payload_overview = {
#     'class1_id':16
# }
#
# r_overview = requests.post('http://localhost:5000/search/v1.1/wechat/class1', json=payload_overview, timeout=200)
# a_overview = r_overview.json()
# print("2\n")
# print(json.dumps(a_overview, indent=4, sort_keys=True, ensure_ascii=False))

# payload_overview = {
#     'class1_name':'女装/女士精品',
#     'term':'女装 精品 内衣'
# }
#
# r_overview = requests.post('http://localhost:5000/search/v1.1/wechat/class1_match', json=payload_overview, timeout=200)
# a_overview = r_overview.json()
# print("2\n")
# print(json.dumps(a_overview, indent=4, sort_keys=True, ensure_ascii=False))


# payload_overview = {
#     'class2_id': 50012037
# }
#
# r_overview = requests.post('http://localhost:5000/search/v1.1/wechat/class2', json=payload_overview, timeout=200)
# a_overview = r_overview.json()
# print("2\n")
# print(json.dumps(a_overview, indent=4, sort_keys=True, ensure_ascii=False))


# payload_overview = {
#      'class2_name': '网球鞋',
#       "class1_id": 50012029,
#       "class1_name": "运动鞋",
#       "term": '运动鞋 莆田 adidas nike 匹克'
#
# }
#
# r_overview = requests.post('http://localhost:5000/search/v1.1/wechat/class2_match', json=payload_overview, timeout=200)
# a_overview = r_overview.json()
# print("2\n")
# print(json.dumps(a_overview, indent=4, sort_keys=True, ensure_ascii=False))

# payload_overview = {
#     'goods_id':11749456
#
# }
#
# r_overview = requests.post('http://localhost:5000/search/v1.1/jd/goods_wordcloud', json=payload_overview, timeout=200)
# a_overview = r_overview.json()
# print("2\n")
# print(json.dumps(a_overview, indent=4, sort_keys=True, ensure_ascii=False))



# payload_overview = {
#       'shop_id':1000000831
#         'shop_id': 118690
# }
#
# r_overview = requests.post('http://localhost:5000/search/v1.1/jd/shop_wordcloud', json=payload_overview, timeout=200)
# a_overview = r_overview.json()
# print("2\n")
# print(json.dumps(a_overview, indent=4, sort_keys=True, ensure_ascii=False))




# payload_overview = {
#       'shop_id': 1000000831,
#       'from': 0,
#       'size': 5,
#       'filters': {
#         'goods_start_date': ['2016-11-21 00:00:00','2016-11-22 00:00:00']
#       }
# }
#
# r_overview = requests.post('http://localhost:5000/search/v1.1/jd/shopgoods', json=payload_overview, timeout=200)
# a_overview = r_overview.json()
# print("2\n")
# print(json.dumps(a_overview, indent=4, sort_keys=True, ensure_ascii=False))

#

#
# payload_overview = {
#       'term':'数码 电脑 办公 手机',
#       'from': 0,
#       'size': 4,
#       'sorted_term':'',
#        'order_by':'overall',
#       'highlight': False,
#       'filters': {
#         'shop_start_date': ['2016-09-20 00:00:00','2016-09-21 00:00:00'],
#          'shop_type' : '商家',
#          'star_score': [7.0, 10.0]
#       }
# }
#
# r_overview = requests.post('http://localhost:5000/search/v1.1/jd/shop_match', json=payload_overview, timeout=200)
# a_overview = r_overview.json()
# print("2\n")
# print(json.dumps(a_overview, indent=4, sort_keys=True, ensure_ascii=False))

#

payload_overview = {
      'term':'黑色',
      'from': 0,
      'size': 5,
      'order_by':'avg_commission_ratio',
      'highlight': False,
      'filters': {
         'shop_start_date': ['2016-09-20 00:00:00','2016-09-21 00:00:00'],
         'shop_type' : '商家',
         'star_score': [7.0, 10.0]
      }
}

r_overview = requests.post('http://localhost:5000/search/v1.1/jd/shopgoods_match_all', json=payload_overview, timeout=200)
a_overview = r_overview.json()
print("2\n")
print(json.dumps(a_overview, indent=4, sort_keys=True, ensure_ascii=False))